﻿@model List<string>
@{
    ViewBag.Title = "Manage Themes";
}

    <div class="main-content">
        <div class="container-fluid padded">
            @if (TempData["SuccessMessage"] != null)
            {
                <div class="alert alert-success">
                    <button class="close" data-dismiss="alert" type="button">
                        ×
                    </button>
                    @TempData["SuccessMessage"]
                </div>
            }
            @if (TempData["ErrorMessage"] != null)
            {
                <div class="alert alert-error">
                    <button class="close" data-dismiss="alert" type="button">
                        ×
                    </button>
                    @Html.Raw(TempData["ErrorMessage"])
                </div>
            }
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-header">
                            <span class="title">Upload Theme</span>
                        </div>
                        <div class="box-content">
                            <div class="padded">
                                @using (Html.BeginForm("Add", "Theme", FormMethod.Post, new { @enctype = "multipart/form-data" }))
                                {
                                    <div class="span4">
                                        <div class="control-group" style="margin-bottom: 0px">
                                            <label class="control-label" style="text-align: left;">
                                                Upload Theme
                                            </label>
                                            <div class="controls">
                                                <input type="file" name="ThemeFile" id="ThemeFile" data-val-required="Please select theme"
                                                       data-val="true" />
                                                <div style="color: red;">
                                                    <span id="nav-url-error" data-valmsg-replace="true" data-valmsg-for="ThemeFile" class="field-validation-valid">
                                                    </span>
                                                </div>
                                                (Only .zip files are allowed.)
                                            </div>
                                        </div>
                                    </div>
                                    <div class="span6">
                                        <div class="control-group">
                                            <label class="control-label" style="text-align: left;">
                                            </label>
                                            <div class="controls">
                                                <input type="submit" value="Install" class="btn btn-blue" />
                                            </div>
                                        </div>
                                    </div>
                                }
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box">
                        <div class="box-header">
                            <span class="title">Theme List</span>
                        </div>
                        <div class="box-content">
                            <div class="padded">
                                
                                @foreach (var item in Model)
                                {
                                    <div style="float:left;">
                                        <div style="width: 100px; margin-left: 15px; text-align: center;">
                                            @item
                                        </div>
                                        <div class="media-thumb">
                                            <img src='/Views/themes/@item/thumbnail.jpg' alt='' style="width:100px;height:100px;" />
                                        </div>
                                        <div style="width: 100px; margin-left: 15px; text-align: center;">
                                            @if (ViewBag.CurrentTheme != item)
                                            { 
                                                @Html.ActionLink("Activate", "Activate", new { themename = item }, new { onclick = "return confirm('Are you sure you want to activate this theme?');" })
                                            }
                                            @if (item.ToLower() != "default")
                                            {
                                                @Html.ActionLink("Delete", "Delete", new { themename = item }, new { onclick = "return confirm('Are you sure you want to Delete this theme?');" })
                                            }
                                        </div>
                                    </div>
                                }
                                
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
